package persistence.database;

import persistence.AllDAO;
import persistence.ContainerDAO;
import persistence.DataPersistenceFactory;
import persistence.ItemDAO;
import persistence.ProductContainerDAO;
import persistence.ProductDAO;
import persistence.ReportDAO;
import persistence.TransactionManager;

/**
 * Factory for database persistence objects
 * @author Sabrina
 *
 */
public class DatabasePersistenceFactory implements DataPersistenceFactory {

	/**
	 * Constructor
	 */
	public DatabasePersistenceFactory()
	{
		
	}
	/**
	 * @inheritDoc
	 */
	@Override
	public ItemDAO getItemDAO() {
		return new DBItemDAO();
	}

	/**
	 * @inheritDoc
	 */
	@Override
	public ProductDAO getProductDAO() {
		return new DBProductDAO();
	}

	/**
	 * @inheritDoc
	 */
	@Override
	public ContainerDAO getContainerDAO() {
		return new DBContainerDAO();
	}

	/**
	 * @inheritDoc
	 */
	@Override
	public ProductContainerDAO getProductContainerDAO() {
		return new DBProductContainerDAO();
	}

	/**
	 * @inheritDoc
	 */
	@Override
	public AllDAO getAllDAO() {
		return new DBAllDAO();
	}

	/**
	 * @inheritDoc
	 */
	@Override
	public ReportDAO getReportDAO() {
		return new DBReportDAO();
	}

	/**
	 * @inheritDoc
	 */
	@Override
	public TransactionManager getTransactionManager() {
		try {
			return new DBTransactionManager();
		} catch (Exception e) {
			return null;
		}
	}
}
